#ifndef __SOCKETIO_H__
#define __SOCKETIO_H__

#include "../Web_Search/WebPage.h"
#include "../../include/nlohmann/json.hpp"
#include <string>
#include <vector>
using std::vector;
using std::string;
using std::pair;
using json = nlohmann::json;

class SocketIO{
public:
    explicit SocketIO(int fd);
    ~SocketIO();
    int readMsg(char *buf);
    int sendMsg(const pair<int, void*> msg);
    void packMsgKey(const vector<string> msgKey, json &msgJson);
    void packMsgWeb(const vector<WebPage> msgWeb, json &msgJson);

private:
    int _fd;
};

#endif
